<template>
	<view class="home">
		<u-sticky bgColor="#fff">
			<view style="background-color: #FFF; height: 20rpx;">
			</view>
			<navigator url="../search/search" hover-class="navigator-hover">
				<u-search :show-action="false" margin="0 50rpx" disabled></u-search>
			</navigator>
			<view class="scroll-list">
				<u-sticky bgColor="#fff">
					<u-tabs :list="list" @click="clickTab"></u-tabs>
				</u-sticky>
			</view>
		</u-sticky>
		<note-box :noteInfo="noteInfo"></note-box>
	</view>
</template>
<script>
	import noteBox from '../../components/noteBox/note_box.vue';
	export default {
		components: {
			noteBox
		},
		onShow(){
		    this.showNote()
		},
		data() {
			return {
				noteInfo:[],
				region:"广州",
				list: [{
					name: '广州',
				}, {
					name: '深圳',
				}, {
					name: '珠海'
				}, {
					name: '佛山'
				}, {
					name: '韶关'
				}, {
					name: '湛江'
				}, {
					name: '茂名'
				}, {
					name: '惠州'
				}, {
					name: '汕头'
				}, {
					name: '潮州'
				}, {
					name: '其他'
				}]
			}
		},
		methods:{
			showNote(){
				uni.request({
					url: 'http://localhost:8081/note/getNoteByRegion',
					method: 'GET',
					data: {
						region:this.region
					},
					success: (res) => {
						//if (res.data.state == 200) {
							this.noteInfo=res.data
					//	}
					}
				});
			},
			clickTab(data){
				this.region = data.name
				this.showNote()
			}
		}
	}
</script>

<style lang="scss">
	.scroll-list {
		margin: 10rpx 0;

		.name_item {
			@include flex(column);
			margin-right: 20px;
			text-align: center;

			text {
				font-size: 30rpx;
				width: 60rpx;
				color: #a1a3a6;
			}
		}
	}
</style>
